<%@page import="database.DBBarang"%>
<%@page import="database.DBSupplier"%>
<%@page import="database.DBPegawai"%>
<%@page import="model.Pengadaan"%>
<%@page import="model.Barang"%>
<%@ include file="header.jsp"%>
<%@page import="model.PegawaiBean"%>
<%@page import="model.Supplyer"%>
<%@page import="java.util.List"%>


<%@page import="database.DBClass"%>
<% Pengadaan beans = new Pengadaan();
    //get request from servlet if data is invalid

    if (request.getAttribute("updateuser") != null) {
        beans = (Pengadaan) request.getAttribute("updateuser");
    }
%>
<SCRIPT LANGUAGE="JavaScript">
    window.defaultStatus = "Let count your number"

    function hapus()
    {
//        a = 5000
//        b = eval(jual.jmlbarang.value)
//        c = a * b
        pengadaan.jmlbarang.value = "";
    }

    function hapus2()
    {
//        a = 5000
//        b = eval(jual.jmlbarang.value)
//        c = a * b
        pengadaan.hargaSatuan.value = "";
    }

</SCRIPT>
<!-- start: Content -->
<div id="content" class="span10">


    <ul class="breadcrumb">
        <li>
            <i class="icon-home"></i>
            <a href="index.html">Home</a>
            <i class="icon-angle-right"></i> 
        </li>
        <li>
            <i class="icon-edit"></i>
            <a href="#">Forms</a>
        </li>
    </ul>



    <div class="row-fluid sortable">
        <div class="box span12">
            <div class="box-header" data-original-title>
                <h2><i class="halflings-icon edit"></i><span class="break"></span>Form Pengadaan</h2>

            </div>
            <div class="box-content">
                <form class="form-horizontal" method="post" action="PengadaanServlet" name="pengadaan">
                    <fieldset>
                        <div class="control-group success">

                            <div class="controls">
                                <INPUT type="hidden" name="id" value="<%=beans.getPengadaanId()%>"

                            </div>
                        </div>
                        <div class="control-group success">
                            <label class="control-label" for="pegawai">Pegawai:</label>
                            <div class="controls">
                                <select id="pegawai" data-validation="required" data-validation-error-msg="Pegawai harus dipilih" name="pegawai" data-rel="chosen">
                                    <option value="<%=beans.getNoPegawai()%>"><%=beans.getNamaPegawai()%></option>
                                    <%
                                        PegawaiBean bean = new PegawaiBean();

                                   
                                        List list = (List) request.getAttribute("listPegawaiPengadaan");
                                   

                                        if (list != null) {
                                            for (int i = 0; i < list.size(); i++) {
                                                bean = (PegawaiBean) list.get(i);

                                    %>
                                    <option value="<%=bean.getPegawaiId()%>"><%=bean.getNama()%></option>

                                    <%          }
                                        }
                                    %>
                                </select>
                            </div>
                        </div>
                        <div class="control-group success">
                            <label class="control-label" for="supplier">Supplier:</label>
                            <div class="controls">
                                <select id="supplier" data-validation="required" data-validation-error-msg="Supplier harus dipilih" name="supplier" data-rel="chosen">
                                    <option value="<%=beans.getNoSupplier()%>"><%=beans.getNamaSupplyer()%></option>
                                    <%
                                        Supplyer bean1 = new Supplyer();

                                       

                                        List list1 = (List) request.getAttribute("listSuppliyerPengadaan");
                                        // request.setAttribute("list", list1);

                                        if (list1 != null) {
                                            for (int i = 0; i < list1.size(); i++) {
                                                bean1 = (Supplyer) list1.get(i);

                                    %>
                                    <option value="<%=bean1.getSupplyerId()%>"><%=bean1.getNama()%></option>

                                    <%
                                            }
                                        }
                                    %>
                                </select>
                            </div>
                        </div>
                        

                        <div class="control-group success">
                            <label class="control-label" for="inputSuccess">Jumlah barang</label>
                            <div class="controls">
                                <input class="input-xlarge" type="text" data-validation="required number" data-validation-error-msg="Jumlah barang harus diisi dengan angka" id="jmlbarang" name="jmlbarang" value="<%=beans.getJumlahBarang()%>" onclick="hapus()">
                                
                            </div>
                        </div>
                        <div class="control-group success">
                            <label class="control-label" for="inputSuccess">Harga satuan:</label>
                            <div class="controls">
                                <input class="input-xlarge" type="text" id="hargaSatuan" data-validation="required number" data-validation-error-msg="Harga satuan harus diisi dengan angka" name="hargaSatuan" value="<%=beans.getHargaSatuan()%>" onclick="hapus2()">
                                <span class="help-inline">Diisi dengan angka</span>
                            </div>
                        </div>
                        <div class="form-actions">
                            <button type="submit" class="btn btn-primary" name="action" value="<%=(beans.getAction())%>"><%=(beans.getAction())%></button>
                            <button class="btn">Cancel</button>
                        </div>
                    </fieldset>
                </form>

            </div>
        </div><!--/span-->

    </div><!--/row-->




</div><!--/.fluid-container-->

<!-- end: Content -->
</div><!--/#content.span10-->
</div><!--/fluid-row-->

<%@ include file="footer.jsp"%>